package com.xuhuan.practice.dto.article;

import com.xuhuan.practice.dto.common.BaseDTO;
import com.xuhuan.practice.validation.annotation.ArticleState;
import com.xuhuan.practice.validator.group.AddGroup;
import com.xuhuan.practice.validator.group.UpdateGroup;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

/**
 * @author: huan.xu
 * @create: 2024/6/13 22:41
 * @description: 文章信息dto
 **/
@Data
public class ArticleInfoDTO extends BaseDTO {

  @NotEmpty(groups = {AddGroup.class, UpdateGroup.class})
  @Pattern(regexp = "^\\S{1,10}$", groups = {AddGroup.class, UpdateGroup.class})
  private String title;

  @NotEmpty(groups = {AddGroup.class, UpdateGroup.class})
  private String content;

  @NotEmpty(groups = {AddGroup.class, UpdateGroup.class})
  @URL(groups = {AddGroup.class, UpdateGroup.class})
  private String coverImg;

  @ArticleState(groups = {AddGroup.class, UpdateGroup.class})
  private String state;

  @NotNull(groups = {AddGroup.class, UpdateGroup.class})
  private Integer categoryId;

  private Integer createUser;
}
